
var bottomOne=document.querySelectorAll('.footer_guide_in_top')
for(var i=0;i<bottomOne.length;i++){
bottomOne[i].addEventListener('click',function(){
    var text=this.nextSibling.nextSibling.innerText
    if(text=="首页"){
        var indexImg='./Images/replaceIndex.png'
        var index='./Images/home2.png'
       changeImgAndText(this,indexImg,index)
        
    }else if(text=='分类'){
        var categoryImg='./Images/replaceCategory.png'
        var category='./Images/categoey.png'
        changeImgAndText(this,categoryImg,category)
    }else if(text=='购物车'){
        var shoppingImg='./Images/replaceShopping.png'
        var shopping='./Images/shoppingCar.png'
        changeImgAndText(this,shoppingImg,shopping)
    }
})
}

function changeImgAndText(element,replaceImg,orginImg){
    var currentImg=element.children[0].src
    if(currentImg.includes('replace')){
      element.children[0].src=orginImg
      element.nextSibling.nextSibling.style.color='black'
    }else{
    element.children[0].src=replaceImg
    element.nextSibling.nextSibling.style.color='orangered'
    }
}
